/**
 * Created with JetBrains PhpStorm.
 * User: ishowshao
 * Date: 12-7-13
 * Time: 下午3:22
 */
FlyFight.model.Matrix = function () {
    this._matrix = [];
};
FlyFight.model.Matrix.prototype.fromArray = function (array) {
    this._matrix = [];
    for (var i = 0; i < array.length; i++) {
        var row = [];
        for (var j = 0; j < array[i].length; j++) {
            row.push(array[i][j]);
        }
        this._matrix.push(row);
    }
    return this;
};
FlyFight.model.Matrix.prototype.init = function (x, y) {
    this._matrix = [];
    for (var i = 0; i < y; i++) {
        var row = [];
        for (var j = 0; j < x; j++) {
            row.push(0);
        }
        this._matrix.push(row);
    }
};
/**
 * 获取行列数
 * @return {Object}
 */
FlyFight.model.Matrix.prototype.getSize = function () {
    return {
        x: this._matrix[0].length,
        y: this._matrix.length
    };
};
/**
 * 获取x,y位置的值
 * @param {Number} x
 * @param {Number} y
 * @return {Number}
 */
FlyFight.model.Matrix.prototype.getXY = function (x, y) {
    return this._matrix[x][y];
};
FlyFight.model.Matrix.prototype.dump = function () {
    console.log(this._matrix);
    return this;
};
FlyFight.model.Matrix.add = function (ma, mb) {

};

